function sum(n, result = 0) {
  if (n === 0) {
    return result;
  }
  
  if (n % 2 === 0) {
    return sum(n - 1, result + 1 / n);
  } else {
    return sum(n - 1, result + 1 / n);
  }
}